import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
import { Reflector } from '@nestjs/core';
import { Observable } from 'rxjs';

@Injectable()
export class AaaInterceptor implements NestInterceptor {

  constructor(private reflector: Reflector){}

  
  intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
    console.log('interceptor');
    console.log(this.reflector.get('roles',context.getHandler()));
    console.log(this.reflector.get('roles',context.getClass()));
    return next.handle();
  }
}
